<!DOCTYPE html>



  


<html class="theme-next gemini use-motion" lang="zh-Hans">
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">











<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="html,">










<meta name="description" content="#html简介@(html基础)[html]  HyperText Markup Language 简称为HTMLHyperText: 超文本 （文本 + 图片 + 视频 + 音频 + 链接）Markup Language: 标记语言由SGML(标准通用标记语言)发展而来写给浏览器的语言注明W3C: World Wide Web Consortium  (W3C理事会或万维网联盟)WHATWG">
<meta name="keywords" content="html">
<meta property="og:type" content="article">
<meta property="og:title" content="html基础">
<meta property="og:url" content="elfeach.gitee.io/2018/01/29/html基础/index.html">
<meta property="og:site_name" content="Elfecho’Blog">
<meta property="og:description" content="#html简介@(html基础)[html]  HyperText Markup Language 简称为HTMLHyperText: 超文本 （文本 + 图片 + 视频 + 音频 + 链接）Markup Language: 标记语言由SGML(标准通用标记语言)发展而来写给浏览器的语言注明W3C: World Wide Web Consortium  (W3C理事会或万维网联盟)WHATWG">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="https://i.loli.net/2020/09/26/YUCVpQbZM1BEy6J.jpg">
<meta property="og:updated_time" content="2020-09-26T15:20:22.068Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="html基础">
<meta name="twitter:description" content="#html简介@(html基础)[html]  HyperText Markup Language 简称为HTMLHyperText: 超文本 （文本 + 图片 + 视频 + 音频 + 链接）Markup Language: 标记语言由SGML(标准通用标记语言)发展而来写给浏览器的语言注明W3C: World Wide Web Consortium  (W3C理事会或万维网联盟)WHATWG">
<meta name="twitter:image" content="https://i.loli.net/2020/09/26/YUCVpQbZM1BEy6J.jpg">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"没有找到与[${query}]相关的内容","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="elfeach.gitee.io/2018/01/29/html基础/">





  <title>html基础 | Elfecho’Blog</title>
  





  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?c491056d7021e5c248129f6222a89004";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>




  
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">
  
  <script type="text/javascript" src="/js/src/crash_cheat.js"></script>
  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Elfecho’Blog</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">有空时来歇歇脚吧</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br>
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br>
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            归档
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br>
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  <div class="popup search-popup local-search-popup">
  <div class="local-search-header clearfix">
    <span class="search-icon">
      <i class="fa fa-search"></i>
    </span>
    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
    <div class="local-search-input-wrapper">
      <input autocomplete="off" placeholder="搜索..." spellcheck="false" type="text" id="local-search-input">
    </div>
  </div>
  <div id="local-search-result"></div>
</div>



    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="elfeach.gitee.io/2018/01/29/html基础/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="elfecho">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Elfecho’Blog">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">html基础</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2018-01-29T10:38:47+08:00">
                2018-01-29
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          
            
            
          

          
            <div class="post-wordcount">
              
                
                <span class="post-meta-item-icon">
                  <i class="fa fa-file-word-o"></i>
                </span>
                
                  <span class="post-meta-item-text">字数统计&#58;</span>
                
                <span title="字数统计">
                  2.1k 字
                </span>
              

              
                <span class="post-meta-divider">|</span>
              

              
                <span class="post-meta-item-icon">
                  <i class="fa fa-clock-o"></i>
                </span>
                
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                
                <span title="阅读时长">
                  9 分钟
                </span>
              
            </div>
          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      
        <div class="post-gallery" itemscope itemtype="http://schema.org/ImageGallery">
          
          
            <div class="post-gallery-row">
              <a class="post-gallery-img fancybox" href="https://i.loli.net/2020/09/26/YUCVpQbZM1BEy6J.jpg" rel="gallery_ckh260l4w000ua4sc3cvooupz" itemscope itemtype="http://schema.org/ImageObject" itemprop="url">
                <img src="https://i.loli.net/2020/09/26/YUCVpQbZM1BEy6J.jpg" itemprop="contentUrl">
              </a>
            
          

          
          </div>
        </div>
      

      
        <p>#html简介<br>@(html基础)[html]</p>
<blockquote>
<p>HyperText Markup Language 简称为HTML<br>HyperText: 超文本 （文本 + 图片 + 视频 + 音频 + 链接）<br>Markup Language: 标记语言<br>由SGML(标准通用标记语言)发展而来<br>写给浏览器的语言<br>注明<br>W3C: World Wide Web Consortium  (W3C理事会或万维网联盟)<br>WHATWG  (Web超文本应用技术工作组)<br><img src="https://i.loli.net/2020/09/26/enmAkZoI8iCz2ES.png" alt></p>
</blockquote>
<hr>
<p>##html元素（标签）</p>
<h3 id="1-lt-DOCTYPE-gt"><a href="#1-lt-DOCTYPE-gt" class="headerlink" title="1. &lt; !DOCTYPE&gt;"></a>1. &lt; !DOCTYPE&gt;</h3><pre><code>&lt; !DOCTYPE&gt;声明必须是 HTML 文档的第一行，位于 &lt; html&gt; 标签之前。
&lt; !DOCTYPE&gt; 声明不是 HTML 标签；它是指示 web 浏览器关于页面使用哪个HTML版本进行编写的指令,其声明没有结束符。
</code></pre><h3 id="2-换行符"><a href="#2-换行符" class="headerlink" title="2. 换行符"></a>2. 换行符</h3><pre><code>&lt;br/&gt;
</code></pre><h3 id="3-段落"><a href="#3-段落" class="headerlink" title="3. 段落"></a>3. 段落</h3><pre><code>&lt;p&gt;这是一个段落&lt;/p&gt;
</code></pre><p>说明：<br>属性          说明<br>align       行对齐方式(left, right右对齐, center居中)</p>
<h3 id="4-标题（h系列）"><a href="#4-标题（h系列）" class="headerlink" title="4. 标题（h系列）"></a>4. 标题（h系列）</h3><pre><code>&lt;h1&gt;标题1&lt;/h1&gt;
&lt;h2&gt;标题2&lt;/h2&gt;
&lt;h3&gt;标题3&lt;/h3&gt;
&lt;h4&gt;标题4&lt;/h4&gt;
&lt;h5&gt;标题5&lt;/h5&gt;
&lt;h6&gt;标题6&lt;/h6&gt;
</code></pre><h3 id="5-文本格式化"><a href="#5-文本格式化" class="headerlink" title="5. 文本格式化"></a>5. 文本格式化</h3><pre><code>&lt;b&gt;定义粗体文本&lt;/b&gt;
&lt;i&gt; 定义斜体文本 &lt;/i&gt;
&lt;del&gt;定义删除文本&lt;/del&gt;
&lt;sup&gt;定义上标字&lt;/sup&gt;
&lt;sub&gt;定义下标字&lt;/sub&gt;
</code></pre><h3 id="6-链接"><a href="#6-链接" class="headerlink" title="6. 链接"></a>6. 链接</h3><pre><code>&lt;a href=“URL”&gt; ~ &lt;/a&gt;
</code></pre><p>说明：<br>href        定义链接地址<br>title       链接提示信息<br>target      链接打开方式(_blank 新的空白页,_self  当前页,_top)</p>
<p>常规应用：</p>
<pre><code>&lt;a href=“http://www.163.com”&gt;外部链接&lt;/a&gt;
&lt;a href=“about.html”&gt;内部链接 &lt;/a&gt;
</code></pre><p>其他应用：</p>
<pre><code>&lt;a href=“mailto:邮箱地址”&gt;邮件链接&lt;/a&gt;
&lt;a href=“tel:电话号码”&gt;一键拨打&lt;/a&gt;
&lt;a href=&quot;sms:139xxxxxxx&quot;&gt;一键发送短信&lt;/a&gt;
</code></pre><h3 id="7-锚点"><a href="#7-锚点" class="headerlink" title="7. 锚点"></a>7. 锚点</h3><p>锚点标签用于使用户”跳”到文档的某个部分。</p>
<pre><code>&lt;a href=&quot;#位置名&quot;&gt; ~ &lt;/a&gt;
&lt;a name=&quot;位置名&quot;&gt; ~ &lt;/a&gt;
</code></pre><h3 id="8-图像"><a href="#8-图像" class="headerlink" title="8. 图像"></a>8. 图像</h3><pre><code>&lt;img src=&quot;URL&quot; width=&quot;100&quot; height=&quot;100&quot; alt=&quot;替代文字&quot; /&gt;
</code></pre><p>说明：</p>
<p>src         定义图像的url<br>alt         定义图像的替代文本<br>width       设置图像的宽度<br>height      设置图像的高度</p>
<h3 id="9-图像热区-扩展"><a href="#9-图像热区-扩展" class="headerlink" title="9. 图像热区(扩展)"></a>9. 图像热区(扩展)</h3><pre><code>&lt;img src=&quot;URL&quot;  usemap=&quot;# map 名称&quot; /&gt;
&lt;map name=&quot;map 名称&quot;&gt;
    &lt;area shape=&quot;形状&quot; coords=&quot;坐标值&quot; href=&quot;URL&quot; /&gt;
&lt;/map&gt;
</code></pre><p>说明：<br>shape       热区形状(rect、circle、poly )<br>coords      形状的坐标值</p>
<h3 id="10-audio-音频"><a href="#10-audio-音频" class="headerlink" title="10. audio(音频)"></a>10. audio(音频)</h3><p>带控制器的音频播放器<br><strong>语法：</strong></p>
<pre><code>&lt;audio src=&quot;song.ogg&quot; controls=&quot;controls&quot;&gt;&lt;/audio&gt;
</code></pre><p>如果考虑到不同浏览器对视频文件的兼容性</p>
<pre><code>&lt;audio width=&quot;320&quot; height=&quot;240&quot; controls=&quot;controls&quot;&gt;
&lt;source src=&quot;song.ogg&quot; type=&quot;audio/ogg&quot;&gt;
&lt;source src=&quot;song.mp3&quot; type=&quot;audio/mpeg&quot;&gt;
</code></pre><p>你的浏览器不支持&lt; audio&gt;标签&lt; /audio&gt;<br><strong>属性说明：</strong></p>
<pre><code>autoplay  autoplay  如果出现该属性，则音频在就绪后马上播放。
controls  controls  如果出现该属性，则向用户显示控件，比如播放按钮。
loop  loop如果出现该属性，则每当音频结束时重新开始播放。
preload preload 如果出现该属性，则音频在页面加载时进行加载，并预备播放。如果       使用 &quot;autoplay&quot;，则忽略该属性。
src url 要播放的音频的 URL。
</code></pre><h4 id="lt-source-gt-标签"><a href="#lt-source-gt-标签" class="headerlink" title="&lt; source &gt;标签"></a>&lt; source &gt;标签</h4><p><strong>标签说明</strong><br>&lt; source&gt; 标签为媒介元素（比如 <video> 和 <audio>）定义媒介资源。<br>&lt; source&gt; 标签允许您规定可替换的视频/音频文件供浏览器根据它对媒体类型或者编解码器的支持进行选择。</audio></video></p>
<p><strong>使用type属性</strong></p>
<pre><code>&lt;video width=&quot;320&quot; height=&quot;240&quot; controls=&quot;controls&quot;&gt;
      &lt;source   src=“movie.mp4”  type=&quot;video/mp4&quot;&gt;
&lt;/video&gt;
</code></pre><p><strong>属性说明：</strong></p>
<table>
<thead>
<tr>
<th style="text-align:left">src</th>
<th style="text-align:center">url</th>
<th style="text-align:center">要播放的媒体文件的URL</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">type</td>
<td style="text-align:center">视频：video/ogg，video/mp4，video/webm</td>
<td style="text-align:center">媒体的MIME类型</td>
</tr>
<tr>
<td style="text-align:left"></td>
<td style="text-align:center">音频：audio/ogg，audio/mpeg</td>
</tr>
</tbody>
</table>
<h3 id="11-video-视频"><a href="#11-video-视频" class="headerlink" title="11.video(视频)"></a>11.video(视频)</h3><p>带控制器的视频播放器</p>
<p>语法：</p>
<pre><code>&lt;video src=“movie.mp4” controls=&quot;controls&quot;&gt;&lt;/video&gt;
</code></pre><p>如果考虑到不同浏览器对视频文件的兼容性</p>
<pre><code>&lt;video width=&quot;320&quot; height=&quot;240&quot; controls=&quot;controls&quot;&gt;
&lt;source src=&quot;movie.ogg&quot; type=&quot;video/ogg&quot;&gt;
&lt;source src=&quot;movie.mp4&quot; type=&quot;video/mp4&quot;&gt;
&lt;p&gt;Your browser does not support the video tag.&lt;/p&gt;
&lt;/video&gt;
</code></pre><p>属性说明：</p>
<pre><code>autoplay:autoplay  如果出现该属性，则视频在就绪后马上播放。
controls:controls  如果出现该属性，则向用户显示控件，比如播放按钮。
loop:loop   如果出现该属性，则当媒介文件完成播放后再次开始播放。
muted:muted 规定视频的音频输出应该被静音。
poster:URL  规定视频下载时显示的图像，或者在用户点击播放按钮前显示的图像。
preload:preload 如果出现该属性，则视频在页面加载时进行加载，并预备播放。如果使用 &quot;autoplay&quot;，则忽略该属性。
src:url 要播放的视频的 URL。
width:pixels    设置视频播放器的宽度。
height:pixels   设置视频播放器的高度。
</code></pre><h3 id="12-HTML-实体字符"><a href="#12-HTML-实体字符" class="headerlink" title="12. HTML 实体字符"></a>12. HTML 实体字符</h3><table>
<thead>
<tr>
<th style="text-align:left">实体字符</th>
<th style="text-align:left">字符实体</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">大于号(&gt;)</td>
<td style="text-align:left">&amp; gt;</td>
</tr>
<tr>
<td style="text-align:left">小于号</td>
<td style="text-align:left">&amp; lt;</td>
</tr>
<tr>
<td style="text-align:left">引号 (“)</td>
<td style="text-align:left">&amp; quot;</td>
</tr>
<tr>
<td style="text-align:left">注册商标(®)</td>
<td style="text-align:left">&amp; reg;</td>
</tr>
<tr>
<td style="text-align:left">版权(© )</td>
<td style="text-align:left">&amp; copy;</td>
</tr>
<tr>
<td style="text-align:left">&amp;号</td>
<td style="text-align:left">&amp; amp;</td>
</tr>
<tr>
<td style="text-align:left">乘号</td>
<td style="text-align:left">&amp; times;</td>
</tr>
</tbody>
</table>
<h2 id="13-无序列表"><a href="#13-无序列表" class="headerlink" title="13.无序列表"></a>13.无序列表</h2><p>列表用来在网页上组织信息，HTML能够创建三种类型的列表：无序列表、有序列表和定义列表。</p>
<p><strong>说明：</strong></p>
<table>
<thead>
<tr>
<th style="text-align:left">属性</th>
<th style="text-align:right">属性值</th>
<th style="text-align:center">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">Type</td>
<td style="text-align:right">disc</td>
<td style="text-align:center">用来设置项目前面的标记</td>
</tr>
<tr>
<td style="text-align:left"></td>
<td style="text-align:right">Circle</td>
<td style="text-align:center"></td>
</tr>
<tr>
<td style="text-align:left"></td>
<td style="text-align:right">square</td>
<td style="text-align:center"></td>
</tr>
</tbody>
</table>
<p><strong>代码结构：</strong></p>
<pre><code>&lt;ul&gt;
    &lt;li&gt;……&lt;/li&gt;
    &lt;li&gt;……&lt;/li&gt;
    &lt;li&gt;……&lt;/li&gt;
&lt;/ul&gt;
</code></pre><h3 id="14-有序列表"><a href="#14-有序列表" class="headerlink" title="14. 有序列表"></a>14. 有序列表</h3><p>有序列表使用数字或字母系统来组织列表里包含的信息。有序列表可以使用数字(默认)、大写字母、小写字母、大写罗马数字和小写罗马数字排列项目。<br><strong>说明</strong>：<br>| 属性        |     属性值               |   说明      |<br>| :——–  | ——–:            | :——: |<br>| type      |   1、 a 、 A、i、I  |    用来设置项目前面的标记|<br>| start     |  数值           |  排序的起点数值|<br><strong>代码结构：</strong></p>
<pre><code>&lt;ol &gt;
&lt;li&gt;……&lt;/li&gt;
&lt;li&gt;……&lt;/li&gt;
&lt;li&gt;……&lt;/li&gt;
&lt;/ol&gt;
</code></pre><h3 id="15-定义列表"><a href="#15-定义列表" class="headerlink" title="15. 定义列表"></a>15. 定义列表</h3><p>定义列表用来组织术语和它们的定义。任何信息如果包含多个术语和相对应的解释，都可以使用定义列表进行组织。</p>
<p><strong>代码结构：</strong></p>
<pre><code>&lt;dl&gt;
&lt;dt&gt;HTML&lt;/dt&gt;
&lt;dd&gt;html 是超文本标记语言&lt;/dd&gt;

&lt;dt&gt;XHTML&lt;/dt&gt;
&lt;dd&gt;可扩展超文本置标语言 &lt;/dd&gt;
&lt;dd&gt;表现方式与超文本置标语言（HTML）类似，不过语法上更加严格 &lt;/dd&gt;
&lt;/dl&gt;
</code></pre><h3 id="16-HTML-表格"><a href="#16-HTML-表格" class="headerlink" title="16. HTML 表格"></a>16. HTML 表格</h3><blockquote>
<p>表格由 &lt; table&gt; 标签以及一个或多个 tr、th或td 元素组成。<br>单元格可以包含文本、图片、列表、段落、表单、水平线、表格等等。</p>
</blockquote>
<p><strong>基本结构：</strong></p>
<pre><code>&lt;table border=&quot;1&quot;&gt;
&lt;tr&gt;
&lt;td&gt;row 1, cell 1&lt;/td&gt;
&lt;td&gt;row 1, cell 2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;row 2, cell 1&lt;/td&gt;
&lt;td&gt;row 2, cell 2&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
</code></pre><p>注明：rowspan为行合并，colspan为列合并</p>
<pre><code>&lt;table&gt; 定义表格
&lt;th&gt; 定义表头
&lt;tr&gt; 定义表格的行
&lt;td&gt; 定义表格单元
</code></pre><p><strong>说明：</strong></p>
<table>
<thead>
<tr>
<th style="text-align:left">属性</th>
<th style="text-align:center">值</th>
<th style="text-align:center">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">table、td属性：<br> width    <br> height</td>
<td style="text-align:center"><br>px、%<br> px、%</td>
<td style="text-align:center"><br>指定表格的宽度 <br> 表格的高度</td>
</tr>
<tr>
<td style="text-align:left">table属性：<br> border  <br> cellpadding <br> cellspacing</td>
<td style="text-align:center"><br>px<br>px<br> px、%</td>
<td style="text-align:center"><br>指定表格边框的宽度   <br> 指定边框与内容之间的空白（间隙）      <br>  指定单元格之间的空白（间隙）</td>
</tr>
<tr>
<td style="text-align:left">td属性：<br> align<br> valign      <br>   colspan                     <br>rowspan<br>bgcolor</td>
<td style="text-align:center"><br>left、 right 、 center<br>top、 middle 、 bottom <br><br> <br>red，#cccccc（灰色）</td>
<td style="text-align:center"><br>指定对齐方式            <br> 垂直排列方式<br>  合并列单元格<br>合并行单元格</td>
</tr>
</tbody>
</table>
<h2 id="HTML背景"><a href="#HTML背景" class="headerlink" title="HTML背景"></a>HTML背景</h2><pre><code>设置背景颜色      &lt;body bgcolor=&quot;#000000&quot;&gt;
设置背景图片      &lt;body background=&quot;bg.jpg&quot;&gt;
设置页面文字颜色    &lt;body text=&quot;#cccccc&quot;&gt;

颜色属性值有三种值的格式
1，英文单词，比如 red , yellow ,green …
    &lt;body bgcolor=&quot;yellow&quot;&gt;
2, 十六进制表示方式，#开头，6个十六进制的字符或数字 组合
   比如：#FFFFFF，#000000，#CCCAAA，#22BCAD
    十六进制： 0-9 和 a-f
3, RGB模式，红 0-255，绿 0-255，蓝 0-255
   比如： RGB(120,33,234)
</code></pre>
      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/html/" rel="tag"># html</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2018/01/29/hexo/" rel="prev" title="hexo搭建">
                hexo搭建 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  
    <div class="comments" id="comments">
      <div id="SOHUCS"></div>
    </div>

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="/images/avatar.jpg" alt="elfecho">
            
              <p class="site-author-name" itemprop="name">elfecho</p>
              <p class="site-description motion-element" itemprop="description">擅长各项前端技能，深入研究移动端开发与前端性能。非专业视觉设计师。此为博客一枚。</p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives/">
              
                  <span class="site-state-item-count">29</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/categories/index.html">
                  <span class="site-state-item-count">5</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/tags/index.html">
                  <span class="site-state-item-count">14</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          

          

          
          

          
          
            <div class="links-of-blogroll motion-element links-of-blogroll-inline">
              <div class="links-of-blogroll-title">
                <i class="fa  fa-fw fa-link"></i>
                Links
              </div>
              <ul class="links-of-blogroll-list">
                
                  <li class="links-of-blogroll-item">
                    <a href="https://elfeach.gitee.io/resume/" title="个人主页" target="_blank">个人主页</a>
                  </li>
                
              </ul>
            </div>
          
          <!-- 网易云音乐 
          <iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=330 height=86 src="//music.163.com/outchain/player?type=2&id=31421442&auto=1&height=66"></iframe> -->

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#1-lt-DOCTYPE-gt"><span class="nav-number">1.</span> <span class="nav-text">1. &lt; !DOCTYPE&gt;</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-换行符"><span class="nav-number">2.</span> <span class="nav-text">2. 换行符</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-段落"><span class="nav-number">3.</span> <span class="nav-text">3. 段落</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#4-标题（h系列）"><span class="nav-number">4.</span> <span class="nav-text">4. 标题（h系列）</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#5-文本格式化"><span class="nav-number">5.</span> <span class="nav-text">5. 文本格式化</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#6-链接"><span class="nav-number">6.</span> <span class="nav-text">6. 链接</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#7-锚点"><span class="nav-number">7.</span> <span class="nav-text">7. 锚点</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#8-图像"><span class="nav-number">8.</span> <span class="nav-text">8. 图像</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#9-图像热区-扩展"><span class="nav-number">9.</span> <span class="nav-text">9. 图像热区(扩展)</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#10-audio-音频"><span class="nav-number">10.</span> <span class="nav-text">10. audio(音频)</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#lt-source-gt-标签"><span class="nav-number">10.1.</span> <span class="nav-text">&lt; source &gt;标签</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#11-video-视频"><span class="nav-number">11.</span> <span class="nav-text">11.video(视频)</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#12-HTML-实体字符"><span class="nav-number">12.</span> <span class="nav-text">12. HTML 实体字符</span></a></li></ol><li class="nav-item nav-level-2"><a class="nav-link" href="#13-无序列表"><span class="nav-number"></span> <span class="nav-text">13.无序列表</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#14-有序列表"><span class="nav-number">1.</span> <span class="nav-text">14. 有序列表</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#15-定义列表"><span class="nav-number">2.</span> <span class="nav-text">15. 定义列表</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#16-HTML-表格"><span class="nav-number">3.</span> <span class="nav-text">16. HTML 表格</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#HTML背景"><span class="nav-number"></span> <span class="nav-text">HTML背景</span></a></li></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; 2018 &mdash; <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">elfecho</span>

  
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-area-chart"></i>
    </span>
    
      <span class="post-meta-item-text">Site words total count&#58;</span>
    
    <span title="Site words total count">39.6k</span>
  
</div>





        
<div class="busuanzi-count">
  <script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="site-uv">
      <i class="fa fa-user"></i> 访问人数
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
      人次
    </span>
  

  
    <span class="site-pv">
      <i class="fa fa-eye"></i> 总访问量
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
      次
    </span>
  
</div>








        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  

  <script type="text/javascript">
    // Popup Window;
    var isfetched = false;
    var isXml = true;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length === 0) {
      search_path = "search.xml";
    } else if (/json$/i.test(search_path)) {
      isXml = false;
    }
    var path = "/" + search_path;
    // monitor main search box;

    var onPopupClose = function (e) {
      $('.popup').hide();
      $('#local-search-input').val('');
      $('.search-result-list').remove();
      $('#no-result').remove();
      $(".local-search-pop-overlay").remove();
      $('body').css('overflow', '');
    }

    function proceedsearch() {
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay"></div>')
        .css('overflow', 'hidden');
      $('.search-popup-overlay').click(onPopupClose);
      $('.popup').toggle();
      var $localSearchInput = $('#local-search-input');
      $localSearchInput.attr("autocapitalize", "none");
      $localSearchInput.attr("autocorrect", "off");
      $localSearchInput.focus();
    }

    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';

      // start loading animation
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay">' +
          '<div id="search-loading-icon">' +
          '<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>' +
          '</div>' +
          '</div>')
        .css('overflow', 'hidden');
      $("#search-loading-icon").css('margin', '20% auto 0 auto').css('text-align', 'center');

      $.ajax({
        url: path,
        dataType: isXml ? "xml" : "json",
        async: true,
        success: function(res) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.header-inner');
          var datas = isXml ? $("entry", res).map(function() {
            return {
              title: $("title", this).text(),
              content: $("content",this).text(),
              url: $("url" , this).text()
            };
          }).get() : res;
          var input = document.getElementById(search_id);
          var resultContent = document.getElementById(content_id);
          var inputEventFunction = function() {
            var searchText = input.value.trim().toLowerCase();
            var keywords = searchText.split(/[\s\-]+/);
            if (keywords.length > 1) {
              keywords.push(searchText);
            }
            var resultItems = [];
            if (searchText.length > 0) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var hitCount = 0;
                var searchTextCount = 0;
                var title = data.title.trim();
                var titleInLowerCase = title.toLowerCase();
                var content = data.content.trim().replace(/<[^>]+>/g,"");
                var contentInLowerCase = content.toLowerCase();
                var articleUrl = decodeURIComponent(data.url);
                var indexOfTitle = [];
                var indexOfContent = [];
                // only match articles with not empty titles
                if(title != '') {
                  keywords.forEach(function(keyword) {
                    function getIndexByWord(word, text, caseSensitive) {
                      var wordLen = word.length;
                      if (wordLen === 0) {
                        return [];
                      }
                      var startPosition = 0, position = [], index = [];
                      if (!caseSensitive) {
                        text = text.toLowerCase();
                        word = word.toLowerCase();
                      }
                      while ((position = text.indexOf(word, startPosition)) > -1) {
                        index.push({position: position, word: word});
                        startPosition = position + wordLen;
                      }
                      return index;
                    }

                    indexOfTitle = indexOfTitle.concat(getIndexByWord(keyword, titleInLowerCase, false));
                    indexOfContent = indexOfContent.concat(getIndexByWord(keyword, contentInLowerCase, false));
                  });
                  if (indexOfTitle.length > 0 || indexOfContent.length > 0) {
                    isMatch = true;
                    hitCount = indexOfTitle.length + indexOfContent.length;
                  }
                }

                // show search results

                if (isMatch) {
                  // sort index by position of keyword

                  [indexOfTitle, indexOfContent].forEach(function (index) {
                    index.sort(function (itemLeft, itemRight) {
                      if (itemRight.position !== itemLeft.position) {
                        return itemRight.position - itemLeft.position;
                      } else {
                        return itemLeft.word.length - itemRight.word.length;
                      }
                    });
                  });

                  // merge hits into slices

                  function mergeIntoSlice(text, start, end, index) {
                    var item = index[index.length - 1];
                    var position = item.position;
                    var word = item.word;
                    var hits = [];
                    var searchTextCountInSlice = 0;
                    while (position + word.length <= end && index.length != 0) {
                      if (word === searchText) {
                        searchTextCountInSlice++;
                      }
                      hits.push({position: position, length: word.length});
                      var wordEnd = position + word.length;

                      // move to next position of hit

                      index.pop();
                      while (index.length != 0) {
                        item = index[index.length - 1];
                        position = item.position;
                        word = item.word;
                        if (wordEnd > position) {
                          index.pop();
                        } else {
                          break;
                        }
                      }
                    }
                    searchTextCount += searchTextCountInSlice;
                    return {
                      hits: hits,
                      start: start,
                      end: end,
                      searchTextCount: searchTextCountInSlice
                    };
                  }

                  var slicesOfTitle = [];
                  if (indexOfTitle.length != 0) {
                    slicesOfTitle.push(mergeIntoSlice(title, 0, title.length, indexOfTitle));
                  }

                  var slicesOfContent = [];
                  while (indexOfContent.length != 0) {
                    var item = indexOfContent[indexOfContent.length - 1];
                    var position = item.position;
                    var word = item.word;
                    // cut out 100 characters
                    var start = position - 20;
                    var end = position + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if (end < position + word.length) {
                      end = position + word.length;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    slicesOfContent.push(mergeIntoSlice(content, start, end, indexOfContent));
                  }

                  // sort slices in content by search text's count and hits' count

                  slicesOfContent.sort(function (sliceLeft, sliceRight) {
                    if (sliceLeft.searchTextCount !== sliceRight.searchTextCount) {
                      return sliceRight.searchTextCount - sliceLeft.searchTextCount;
                    } else if (sliceLeft.hits.length !== sliceRight.hits.length) {
                      return sliceRight.hits.length - sliceLeft.hits.length;
                    } else {
                      return sliceLeft.start - sliceRight.start;
                    }
                  });

                  // select top N slices in content

                  var upperBound = parseInt('1');
                  if (upperBound >= 0) {
                    slicesOfContent = slicesOfContent.slice(0, upperBound);
                  }

                  // highlight title and content

                  function highlightKeyword(text, slice) {
                    var result = '';
                    var prevEnd = slice.start;
                    slice.hits.forEach(function (hit) {
                      result += text.substring(prevEnd, hit.position);
                      var end = hit.position + hit.length;
                      result += '<b class="search-keyword">' + text.substring(hit.position, end) + '</b>';
                      prevEnd = end;
                    });
                    result += text.substring(prevEnd, slice.end);
                    return result;
                  }

                  var resultItem = '';

                  if (slicesOfTitle.length != 0) {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + highlightKeyword(title, slicesOfTitle[0]) + "</a>";
                  } else {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + title + "</a>";
                  }

                  slicesOfContent.forEach(function (slice) {
                    resultItem += "<a href='" + articleUrl + "'>" +
                      "<p class=\"search-result\">" + highlightKeyword(content, slice) +
                      "...</p>" + "</a>";
                  });

                  resultItem += "</li>";
                  resultItems.push({
                    item: resultItem,
                    searchTextCount: searchTextCount,
                    hitCount: hitCount,
                    id: resultItems.length
                  });
                }
              })
            };
            if (keywords.length === 1 && keywords[0] === "") {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-search fa-5x" /></div>'
            } else if (resultItems.length === 0) {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>'
            } else {
              resultItems.sort(function (resultLeft, resultRight) {
                if (resultLeft.searchTextCount !== resultRight.searchTextCount) {
                  return resultRight.searchTextCount - resultLeft.searchTextCount;
                } else if (resultLeft.hitCount !== resultRight.hitCount) {
                  return resultRight.hitCount - resultLeft.hitCount;
                } else {
                  return resultRight.id - resultLeft.id;
                }
              });
              var searchResultList = '<ul class=\"search-result-list\">';
              resultItems.forEach(function (result) {
                searchResultList += result.item;
              })
              searchResultList += "</ul>";
              resultContent.innerHTML = searchResultList;
            }
          }

          if ('auto' === 'auto') {
            input.addEventListener('input', inputEventFunction);
          } else {
            $('.search-icon').click(inputEventFunction);
            input.addEventListener('keypress', function (event) {
              if (event.keyCode === 13) {
                inputEventFunction();
              }
            });
          }

          // remove loading animation
          $(".local-search-pop-overlay").remove();
          $('body').css('overflow', '');

          proceedsearch();
        }
      });
    }

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched === false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(onPopupClose);
    $('.popup').click(function(e){
      e.stopPropagation();
    });
    $(document).on('keyup', function (event) {
      var shouldDismissSearchPopup = event.which === 27 &&
        $('.search-popup').is(':visible');
      if (shouldDismissSearchPopup) {
        onPopupClose();
      }
    });
  </script>





  

  

  

  
  

  

  

  

</body>
</html>
